using System;
using Web.App.Infrastructure.ApplicationMessages.Contracts;

namespace Webshop20.Application
{
    public abstract class ServiceBase : IService 
    {
        protected IDomainMessage domainMessage;
        protected const IDomainMessage WITHOUT_DOMAIN_MESSAGE = null;

        internal void HandleDomainException(IDomainMessage incomingDomainMessage)
        {
            domainMessage = incomingDomainMessage;
        }

        protected bool DomainReportsFailure()
        {
            return domainMessage != null;
        }

        public virtual ISystemMessage Handle(ISystemMessage request)
        {
            throw new NotImplementedException();
        }
    }
}